/* 
* This module is part of the Entertainment Network system 
* Copyright (c) SCC Soft Computer, Inc. 2018 
* All Rights Reserved 
* 
* This document contains unpublished, confidential and proprietary 
* information of SCC Soft Computer, Inc. No disclosure or use of 
* any portion of the contents of these materials may be made without the 
* express written consent of Soft Computer Consultants, Inc. 
* 
*/ 

package isd.dp.ua.EntertainmentNetworkServer.Models;
// Generated Mar 14, 2018 11:11:06 AM by Hibernate Tools 3.6.0.Final

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;

import isd.dp.ua.EntertainmentNetworkServer.Common.BaseModel;

/**
 * Scheduler generated by hbm2java
 */
@SuppressWarnings("serial")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType
@Entity
@Table(name = "SCHEDULER", schema = "PBAB")
public class Scheduler extends BaseModel implements java.io.Serializable 
{
	public Scheduler() 
	{
	}

	public Scheduler(BigDecimal schId, Hall hall, Show show, String schName, String schDescr) 
	{
		this.schId = schId;
		this.hall = hall;
		this.show = show;
		this.schName = schName;
		this.schDescr = schDescr;
	}

	public Scheduler(BigDecimal schId, Hall hall, Show show, String schName, String schDescr, Date schTimeFrom, Date schTimeTo,
			Set<Tickets> ticketses) 
	{
		this.schId = schId;
		this.hall = hall;
		this.show = show;
		this.schName = schName;
		this.schDescr = schDescr;
		this.schTimeFrom = schTimeFrom;
		this.schTimeTo = schTimeTo;
		this.ticketses = ticketses;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SCH_SEQ")
    @SequenceGenerator(name = "SCH_SEQ", sequenceName = "SCH_SEQ")
	@Column(name = "SCH_ID", unique = true, nullable = false, precision = 22, scale = 0)
	public BigDecimal getSchId()
	{
		return this.schId;
	}

	public void setSchId(BigDecimal schId)
	{
		this.schId = schId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SCH_HAL_ID", nullable = false)
	public Hall getHall() 
	{
		return this.hall;
	}

	public void setHall(Hall hall)
	{
		this.hall = hall;
	}
	
	@Transient
	@XmlElement
	public BigDecimal getHallId()
	{
		return this.getHall() == null ? new BigDecimal("-1") : this.getHall().getHalId();
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SCH_SHW_ID", nullable = false)
	public Show getShow()
	{
		return this.show;
	}

	public void setShow(Show show) 
	{
		this.show = show;
	}
	
	@Column(name = "SCH_NAME", nullable = false, length = 100)
	public String getSchName() 
	{
		return this.schName;
	}

	public void setSchName(String schName) 
	{
		this.schName = schName;
	}

	@Column(name = "SCH_DESCR")
	public String getSchDescr() 
	{
		return this.schDescr;
	}

	public void setSchDescr(String schDescr) 
	{
		this.schDescr = schDescr;
	}
	
	@Transient
	@XmlElement
	public BigDecimal getShowId()
	{
		return this.getShow() == null ? new BigDecimal("-1") : this.getShow().getShwId();
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "SCH_TIME_FROM", length = 7)
	public Date getSchTimeFrom() 
	{
		return this.schTimeFrom;
	}

	public void setSchTimeFrom(Date schTimeFrom)
	{
		this.schTimeFrom = schTimeFrom;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "SCH_TIME_TO", length = 7)
	public Date getSchTimeTo() 
	{
		return this.schTimeTo;
	}

	public void setSchTimeTo(Date schTimeTo)
	{
		this.schTimeTo = schTimeTo;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "scheduler")
	public Set<Tickets> getTicketses() 
	{
		return this.ticketses;
	}

	public void setTicketses(Set<Tickets> ticketses) 
	{
		this.ticketses = ticketses;
	}
	
	@Override
	public String toString()
	{
		return "Scheduler [schId=" + this.getSchId() + "]";
	}
	
	private BigDecimal schId;
	@XmlTransient
	private Hall hall;
	@XmlTransient
	private Show show;
	private String schName;
	private String schDescr;
	private Date schTimeFrom;
	private Date schTimeTo;
	@XmlTransient
	private Set<Tickets> ticketses = new HashSet<Tickets>(0);
}
